package com.cakeshop.dao;

import com.cakeshop.model.Comment;

import java.sql.SQLException;
import java.util.List;

/**
 * @author nineice
 * @date 2021/8/23 21:23
 */
public interface CommentDao {

    /**
     * 插入评论
     *
     * @param comment: 评论
     * @throws SQLException: sql异常
     */
    void insertComment(Comment comment) throws SQLException;

    /**
     * 根据id更新数据
     *
     * @param comment : 新的评论信息
     * @throws SQLException: sql异常
     */
    void updateById(Comment comment) throws SQLException;

    /**
     * 根据id删除数据
     *
     * @param id : 评论id
     * @throws SQLException: sql异常
     */
    void deleteById(int id) throws SQLException;

    /**
     * 根据id查询所有数据
     *
     * @return List<Comment>
     * @throws SQLException: sql异常
     */
    List<Comment> findAll() throws SQLException;


    /**
     * 根据id查询数据
     *
     * @param id : 评论id
     * @return Comment
     * @throws SQLException: sql异常
     */
    Comment findById(int id) throws SQLException;

}
